/**
 * 
 */
package vn.cuhanh.sdk;

import java.io.FileNotFoundException;
import java.io.IOException;
import java.net.MalformedURLException;

import org.apache.http.HttpException;
import org.json.JSONException;

import android.util.Log;

import com.android.zing.ZME_Error;
import com.android.zing.api.ZME_ASyncGraphAPI.RequestListener;

/**
 * @author trangdoan
 *
 */
public abstract class BaseRequestListener implements RequestListener{

	public static final String TAG = "BaseRequestListener";
	
    /**
     * Called when a request has a network or request error.
     *
     * Executed by a background thread: do not update the UI in this method.
     */
    public void onIOException(IOException e){}
    
    public void onNullPointerException( NullPointerException e){}
    
    public void onJsonException( JSONException e){}

    /**
     * Called when a request fails because the requested resource is
     * invalid or does not exist.
     *
     * Executed by a background thread: do not update the UI in this method.
     */
    public void onFileNotFoundException(FileNotFoundException e){}

    /**
     * Called if an invalid graph path is provided (which may result in a
     * malformed URL).
     *
     * Executed by a background thread: do not update the UI in this method.
     */
    public void onMalformedURLException(MalformedURLException e){}

    /**
     * Called when the server-side Facebook method fails.
     *
     * Executed by a background thread: do not update the UI in this method.
     */
    public void onZmeError(ZME_Error e){
    	Log.d(TAG, "onZmeError - error happened!");
    	Log.d(TAG, e.getStackTrace().toString());
    	
    }
    
    public void onHttpException( HttpException e){}
    
    //will call when started upload, with length of file
	public void onProgressStarted(long lengthOfFile){}

	//will call with percent uploaded. If cancel upload return 1; if continue upload return 0
    public int onProgress(int percent){
    	return 0;
    }

	//will call when upload finished
    public void onProgressFinished() {}

	//will call when upload error
    public void onProgressError(String errorMsg){}

	//will call when upload cancel
    public void onCancelUpload(){}
}
